package com.woniuxy.oa.entity;

import java.io.Serializable;

import com.woniuxy.oa.utils.BirthdayToAgeUtil;

/** 
 * 年龄为-1时，生日有误
 * @author lqj
 */
public class Employee implements Serializable{
	private static final long serialVersionUID = 1L;
	private Integer id;
	private String username;
	private String password;
	private String salt;
	private String name;
	private String gender;
	private String tellphone;
	private String email;
	private String birthday;
	private Integer age;
	private String idcard;
	private String icon;
	public Employee() {
		super();
		// TODO Auto-generated constructor stub
	}
	public Employee(Integer id, String username, String password, String salt, String name, String gender,
			String tellphone, String email, String birthday, Integer age, String idcard, String icon) {
		super();
		this.id = id;
		this.username = username;
		this.password = password;
		this.salt = salt;
		this.name = name;
		this.gender = gender;
		this.tellphone = tellphone;
		this.email = email;
		this.birthday = birthday;
		this.age = age;
		this.idcard = idcard;
		this.icon = icon;
	}
	@Override
	public String toString() {
		return "Employee [id=" + id + ", username=" + username + ", password=" + password + ", salt=" + salt + ", name="
				+ name + ", gender=" + gender + ", tellphone=" + tellphone + ", email=" + email + ", birthday="
				+ birthday + ", age=" + age + ", idcard=" + idcard + ", icon=" + icon + "]";
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getSalt() {
		return salt;
	}
	public void setSalt(String salt) {
		this.salt = salt;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getGender() {
		return gender;
	}
	public void setGender(String gender) {
		this.gender = gender;
	}
	public String getTellphone() {
		return tellphone;
	}
	public void setTellphone(String tellphone) {
		this.tellphone = tellphone;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getBirthday() {
		return birthday;
	}
	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}
	public Integer getAge() {
		if(birthday != null) {
			try {
				age = BirthdayToAgeUtil.getAge(birthday);
			} catch (Exception e) {
				age = -1;
			}
		}
		return age;
	}
	public String getIdcard() {
		return idcard;
	}
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	public String getIcon() {
		return icon;
	}
	public void setIcon(String icon) {
		this.icon = icon;
	}	
}
